<div class="right">
	<script type="text/javascript" src="js/admin/business_edit.js"></script> 
	<script language='javascript' type='text/javascript'>
	$(document).ready(function() {	
		var rpath = getRootPath();
		if($('#class1').val()>0){
			$.getJSON(rpath+ "/admin/business/getClassTA", {
				id : $('#class1').val()
			}, function(data) {
				$('#class2').empty();
				if(data['ret']==1){
					for(var tmp in data['class2List']){
						$('#class2').append($('<option></option>').text(data['class2List'][tmp]['name']).val(data['class2List'][tmp]['id']));
					}
				}else
					$('#class2').append($('<option></option>').text("无").val(0));
				<?php if(set_value('class2')):?>
					$('#class2').val(<?=set_value('class2')?>);
				<?php endif;?>
			});
		}
		
		if($('#region').val()>0){
			$.getJSON(rpath+ "/admin/business/getAreaTA", {
				id : $('#region').val()
			}, function(data) {
				$('#area').empty();
				if(data['ret']==1){
					for(var tmp in data['areaList']){
						$('#area').append($('<option></option>').text(data['areaList'][tmp]['name']).val(data['areaList'][tmp]['id']));
					}
				}else $('#area').append($('<option></option>').text("无").val(0));
				<?php if(set_value('area')):?>
				$('#area').val(<?=set_value('area')?>);
				<?php endif;?>
			});
		}
	});
	</script>
	<div id="bread-nav" class="fn-clear">
		<ul>
			<li><a href="admin/home">后台首页</a></li>
			<li><a>特约商户添加</a></li>
		</ul>
	</div>
	<div id="content" class="text-darkgrey">
		<h2>特约商户添加</h2>
		
		<?=form_open("admin/business/add/",$form)?>
			<p>　　商户名：<input id="name" type="text" name="name" value="<?=set_value('name')?>"/>
			<?=form_error('name','<label>', '</label>')?></p>
			<p>　商户总店：<input id="groupName" type="text" name="groupName" value="<?=set_value('groupName')?>"/>
			<?=form_error('groupName','<label>', '</label>')?></p>
			<p>　　地　址：<input id="address" type="text" name="address" value="<?=set_value('address')?>"/>
			<?=form_error('address','<label>', '</label>')?></p>
			<p>　　电　话：<input id="phone" type="text" name="phone" value="<?=set_value('phone')?>"/>
			<?=form_error('phone','<label>', '</label>')?></p>
			<p>
				　一级分类：
				<select name="class1" id="class1">
				<?php foreach ($class1List as $row):?>
					<option value="<?=$row['id']?>" <?php if(set_value('class1')==$row['id']):?>selected="selected"<?php endif;?>><?=$row['name']?></option>
				<?php endforeach;?>
				</select>
				<?=form_error('class1','<label>', '</label>')?>
				　二级分类：
				<select name="class2" id="class2">
					<option value="0" selected="selected">无</option>
				</select>
				<?=form_error('class2','<label>', '</label>')?>
				　行政区：
				<select name="region" id="region">
				<?php foreach ($regionList as $row):?>
					<option value="<?=$row['id']?>" <?php if(set_value('region')==$row['id']):?>selected="selected"<?php endif;?>><?=$row['name']?></option>
				<?php endforeach;?>
				</select>
				<?=form_error('region','<label>', '</label>')?>
				　商区：
				<select name="area" id="area">
					<option value="0" selected="selected">无</option>
				</select>
				<?=form_error('area','<label>', '</label>')?>
			</p>
			<p>描述 ：<input id="details" type="text" name="details" value="<?=set_value('details')?>"/>
			<?=form_error('details','<label>', '</label>')?>
			</p>
			<p>　商户图片：<input name="userfile" type="file"  value="浏览" /></p>
			<p>　首页推送：
				<input class="short-input" name="show" type="checkbox" value="T" <?php if(set_value('show')=='T'):?>checked<?php endif;?>/>
			</p>
			<p>是否可回收：
				<input class="short-input" name="recycle" type="checkbox" value="T" <?php if(set_value('recycle')=='T'):?>checked<?php endif;?>/>
			</p>
			<p>状态：
				<select name="state" id="state">
					<option value="N" <?php if(set_value('state')=='N'):?>selected="selected"<?php endif;?>>正常</option>
					<option value="U" <?php if(set_value('state')=='U'):?>selected="selected"<?php endif;?>>即将开通</option>
					<option value="P" <?php if(set_value('state')=='P'):?>selected="selected"<?php endif;?>>暂停使用</option>
					<option value="S" <?php if(set_value('state')=='S'):?>selected="selected"<?php endif;?>>停用</option>
				</select>
			</p>
			<p><input type="submit" id="submitCheck" value="添加" class="submit"></p>
		</form>
	</div>
</div>